 export var clearJSONSpecialCode=function(dat) {
    var newdata;
    if (typeof dat === 'string') {
        var rArr = [];
        var nstr = enCode(dat);
        var reg = new RegExp(rArr.join('|'), 'g');
        return deCode(nstr);

        function enCode(data) {
            try {
                JSON.parse(data);
                return data;
            } catch (e) {
                var pos = e.stack.match(/JSON\sat\sposition\s+(\w+)/)[1];
                if (pos) {
                    var str = data[pos];
                    data = data.replace(str, function (s) {
                        var ens = encodeURI(s);
                        ens = 'decodeURI' + ens;
                        rArr.push(ens)
                        return ens
                    });
                    var nstr = enCode(data);
                    return nstr //	
                } else {
                    alert('JSON解析失败：存在特殊字符。') 
                    return data;
                }
            }
        }

        function deCode(str) {
            var nobj = JSON.parse(str);

            function replaceRStr(obj) {
                if (typeof obj !== 'object') {
                    return;
                }
                if (obj instanceof Array) {
                    obj.forEach(function (o) {
                        replaceRStr(o);
                    })
                    return;
                }
                for (var i in obj) {
                    if (obj.hasOwnProperty(i)) {
                        var val = obj[i];
                        if (typeof val === 'object') {
                            replaceRStr(val);
                        } else if (typeof val === 'string') {
                            obj[i] = val.replace(reg, function (str) {
                                var r = new RegExp(str),
                                    s = str.replace('decodeURI', '');

                                return decodeURI(s);
                            })
                        }
                    }
                }
            }
            replaceRStr(nobj);
            return nobj
        }
    } else {
        newdata = dat;
    }
    return newdata
}